<!DOCTYPE html>
<html>
<head>
    <title>注册</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="application/x-javascript"> addEventListener("load", function () {
        setTimeout(hideURLbar, 0);
    }, false);

    function hideURLbar() {
        window.scrollTo(0, 1);
    } </script>
    <meta name="keywords"
          content="Flat Dark Web Login Form Responsive Templates, Iphone Widget Template, Smartphone login forms,Login form, Widget Template, Responsive Templates, a Ipad 404 Templates, Flat Responsive Templates"/>
    <link href="static/login/style.css" rel='stylesheet' type='text/css'/>
    <!--webfonts-->
    <link href='http://fonts.useso.com/css?family=PT+Sans:400,700,400italic,700italic|Oswald:400,300,700'
          rel='stylesheet' type='text/css'>
    <link href='http://fonts.useso.com/css?family=Exo+2' rel='stylesheet' type='text/css'>
    <!--//webfonts-->
    <script src="http://ajax.useso.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="static/jquery/jquery-3.3.1.min.js"></script>
</head>
<body>
<script>
    $(document).ready(function (c) {
    $('.close').on('click', function (c) {
        $('.login-form').fadeOut('slow', function (c) {
            $('.login-form').remove();
        });
    });
});
</script>
<script type="text/javascript">
    function submitBtn() {
        alert($("#username").val())
        // Ajax提交数据
        $.ajax({
            url: "/userRegister",    // 提交到controller的url路径
            type: "post",    // 提交方式
            contentType: "application/json; charset=utf-8",
            dataType: "json", // 服务器端返回的数据类型
            data: JSON.stringify({
                "username": $("#username").val(),
                "password": $("#password").val()
            }),
            success: function (data) {    // 请求成功后的回调函数，其中的参数data为controller返回的map,也就是说,@ResponseBody将返回的map转化为JSON格式的数据，然后通过data这个参数取JSON数据中的值
                if (data ) {
                    //跳转到登录首页
                    location.href ="login.html"
                } else {

                }
            }
        });
    }

</script>
<!--SIGN UP-->
<h1>陌陌酒店平台注册</h1>
<div class="login-form">
    <div class="close"></div>
    <div class="head-info">
        <label class="lbl-1"> </label>
        <label class="lbl-2"> </label>
        <label class="lbl-3"> </label>
    </div>
    <div class="clear"></div>
    <div class="avtar">
        <img src="static/login/images/avtar.png"/>
    </div>
        <form>
            <input id="username" type="text" class="text" placeholder="用户名">
            <div class="key">
                <input id="password" type="password" placeholder="密码">
            </div>

            <div class="signin">
                <!--        <button> <a href="#" onclick="submitBtn()">注册</a></button>-->
                <button type="submit" class="btn btn-xs btn-green" onclick="submitBtn()">注册</button>
            </div>
        </form>


</div>
</body>
</html>